package top.yangyitao.lockManager.aop;

import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import top.yangyitao.lockManager.lock.LockManager;

@Aspect
@Slf4j
@Order(Ordered.LOWEST_PRECEDENCE)
@Component
public class TimerLockReleaseAdvice {
	@Autowired
    LockManager lockManager;
	//负责定时任务的系统线程
	@After("execution(* top.yangyitao.timer..*.*(..))")
	public void After(JoinPoint point) throws Throwable{
		log.info("lockManager: clear all lock");
		lockManager.retireAll();
	}
}
